<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<!--{hook admin_user_update_start.htm}-->

<div class="row">
	<div class="col-lg-8 offset-lg-2">
		<div class="btn-group m-b-1" role="group">
			<?php echo admin_tab_active($menu['pay']['tab'], 'channel');?>
		</div>
		<div class="card">
			<div class="card-block">
				<h4 class="card-title">添加通道</h4>
				<form action="<?php echo url("pay-channeladd");?>" method="post" id="form">
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">名称：</label>
						<div class="col-sm-10">
							<input type="text" id="name" name="name" class="form-control">
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">支付宝：</label>
						<div class="col-sm-10">
							<input type="text" id="alipay_account" name="alipay_account" class="form-control">
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">姓名：</label>
						<div class="col-sm-10">
							<input type="text" id="alipay_realname" name="alipay_realname" class="form-control">
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">所属网关：</label>
						<div class="col-sm-10">
							<select id="gate_id" name="gate_id" class="form-control">
								<?php foreach($gateway as $g){ ?>
									<option value="<?php echo $g['id'];?>"><?php echo $g['name'];?></option>
								<?php } ?>
							</select>
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">单笔最大限额：</label>
						<div class="col-sm-10">
							<input type="text" id="max_limit" name="max_limit" class="form-control">
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">地区：</label>
						<div class="col-sm-10">
							<select id="area" name="area[]" class="form-control selectpicker" multiple data-live-search="true" data-style="btn-info">
								<?php foreach($area as $a){ ?>
								<option value="<?php echo $a['id'];?>"><?php echo $a['name'];?></option>
								<?php } ?>
							</select>
						</div>
					</div>					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">分类：</label>
						<div class="col-sm-10">
							<select id="cate" name="cate" class="form-control selectpicker" data-live-search="true" data-style="btn-info">
								<option value="0">请选择分类</option>
								<?php foreach($cate as $c){ ?>
								<option value="<?php echo $c['id'];?>"><?php echo $c['name'];?></option>
								<?php } ?>
							</select>
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">HOST：</label>
						<div class="col-sm-10">
							<input type="text" id="host" name="host" class="form-control">
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">状态：</label>
						<div class="col-sm-10">
							<select id="is_open" name="is_open" class="form-control">
								<option value="1">开</option>
								<option value="0">关</option>
							</select>
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">安全码：</label>
						<div class="col-sm-10">
							<input type="password" id="passcode" name="passcode" class="form-control">
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label"></label>
						<div class="col-sm-10">
							<button type="submit" class="btn btn-primary btn-block" id="submit" data-loading-text="提交中...">确认</button>
							<a role="button" class="btn btn-secondary btn-block m-t-1" href="javascript:history.back();">返回</a>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<!--{hook admin_user_update_end.htm}-->

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<link rel="stylesheet" href="view/css/bootstrap-select.css">
<script src="view/js/bootstrap-select.js"></script>

<script>
var jform = $('#form');
var jsubmit = $('#submit');
jform.on('submit', function() {
	jform.reset();
	jsubmit.button('loading');
	var postdata = jform.serialize();
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			$.alert(message);
			jsubmit.text(message).delay(3000).button('reset');
		} else if(code < 0) {
			$.alert(message);
			jsubmit.button('reset');
		} else {
			alert(message);
			jform.find('[name="'+code+'"]').alert(message).focus();
			jsubmit.button('reset');
		}
	});
	return false;
});

$('#nav_pc li.pay, #nav_mobile li.pay').tab('show');

</script>